﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MasterPage.Master" AutoEventWireup="true" CodeBehind="ListSalesmen.aspx.cs" Inherits="DrivingCRM.Views.Private.CRM.ListSalesmen" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="banniere" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="nav" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="contenu" runat="server">
    <asp:EntityDataSource ID="DS_Agences" runat="server" 
        ConnectionString="name=Model_DrivingCRMContainer" 
        DefaultContainerName="Model_DrivingCRMContainer" EnableFlattening="False" 
        EntitySetName="AgencySet" EntityTypeFilter="Agency">
    </asp:EntityDataSource>

    <h2>Liste des vendeurs</h2>

    Agence: 
    <asp:DropDownList ID="DDL_Agences" runat="server" DataSourceID="DS_Agences" 
        DataTextField="Name" DataValueField="IdAgency" AutoPostBack="true">
    </asp:DropDownList>

    <asp:EntityDataSource ID="DS_Salesmen" runat="server" 
        ConnectionString="name=Model_DrivingCRMContainer" 
        DefaultContainerName="Model_DrivingCRMContainer" EnableDelete="True" 
        EnableFlattening="False" EntitySetName="UserSet" EntityTypeFilter="Salesman"
        Include="Agency" Where="it.AgencyIdAgency == @IdAgency">
        <WhereParameters>
            <asp:ControlParameter ControlID="DDL_Agences" DbType="Int32" PropertyName="SelectedValue" Name="IdAgency" />
        </WhereParameters>
    </asp:EntityDataSource>

    <asp:ListView ID="LV_Salesmen" runat="server" DataKeyNames="Id" 
        DataSourceID="DS_Salesmen" GroupItemCount="3">
        <AlternatingItemTemplate>
            <td runat="server" style="background-color:#FFF8DC;">
                <table>
                    <tr>
                        <td>Prénom:</td>
                        <td><asp:Label ID="FirstnameLabel" runat="server" Text='<%# Eval("Firstname") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nom:</td>
                        <td><asp:Label ID="LastnameLabel" runat="server" Text='<%# Eval("Lastname") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nom d'utilisateur:</td>
                        <td><asp:Label ID="UsernameLabel" runat="server" Text='<%# Eval("Username") %>' /></td>
                    </tr>
                    <tr>
                        <td>E-mail:</td>
                        <td><asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' /></td>
                    </tr>
                    <tr>
                        <td>Date de naissance:</td>
                        <td><asp:Label ID="DateOfBirthLabel" runat="server" Text='<%# string.Format("{0:dd/MM/yyyy}",Eval("DateOfBirth")) %>' /></td>
                    </tr>
                    <tr>
                        <td>Agence:</td>
                        <td><asp:Label ID="AgencyLabel" runat="server" Text='<%# Eval("Agency.Name") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nombre de ventes:</td>
                        <td><asp:Label ID="NumberSalesLabel" runat="server" Text='<%# Eval("NumberSales") %>' /></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Supprimer" /></td>
                    </tr>
                </table>
            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        <h2>Aucun vendeur en base</h2></td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
<td runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
            
        </InsertItemTemplate>
        <ItemTemplate>
            <td runat="server" style="background-color:#DCDCDC;color: #000000;">
                <table>
                    <tr>
                        <td>Prénom:</td>
                        <td><asp:Label ID="FirstnameLabel" runat="server" Text='<%# Eval("Firstname") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nom:</td>
                        <td><asp:Label ID="LastnameLabel" runat="server" Text='<%# Eval("Lastname") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nom d'utilisateur:</td>
                        <td><asp:Label ID="UsernameLabel" runat="server" Text='<%# Eval("Username") %>' /></td>
                    </tr>
                    <tr>
                        <td>E-mail:</td>
                        <td><asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' /></td>
                    </tr>
                    <tr>
                        <td>Date de naissance:</td>
                        <td><asp:Label ID="DateOfBirthLabel" runat="server" Text='<%# string.Format("{0:dd/MM/yyyy}",Eval("DateOfBirth")) %>' /></td>
                    </tr>
                    <tr>
                        <td>Agence:</td>
                        <td><asp:Label ID="AgencyLabel" runat="server" Text='<%# Eval("Agency.Name") %>' /></td>
                    </tr>
                    <tr>
                        <td>Nombre de ventes:</td>
                        <td><asp:Label ID="NumberSalesLabel" runat="server" Text='<%# Eval("NumberSales") %>' /></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Supprimer" /></td>
                    </tr>
                </table>
            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="12">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" PreviousPageText="Précédent" FirstPageText="Première page" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" NextPageText="Suivant" LastPageText="Dernière page" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            
        </SelectedItemTemplate>
    </asp:ListView>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="footer" runat="server">
</asp:Content>
